import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:'/index'
  },
  {
    path:'*',
    component: () => import('../views/404/index.vue'),
  },
  {
    path: '/index',
    component: () => import('../views/index.vue'),
    children:[
      {
        path:'/home',
        component: () => import('../views/home/index.vue'),
      },
      {
        path:'/cart',
        component: () => import('../views/cart/index.vue'),
      },
      {
        path:'/cate',
        component: () => import('../views/cate/index.vue'),
      },
      {
        path:'/user',
        component: () => import('../views/user/index.vue'),
      },
      {
        path:'/',
        redirect:'/home'
      },
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
